import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '../components/login.vue'
import Home from '../components/home.vue'
import Welcome from '../components/welcome.vue'
import Users from '../components/users/users.vue'
import Rights from '../components/rights/rights1.vue'
import Roles from '../components/rights/roles.vue'
import goodList from '../components/goods/goodList.vue'
import goodSort from '../components/goods/goodSort.vue'
import Sort from '../components/goods/sort.vue'
import Addgoods from '../components/goods/addgoods.vue'

Vue.use(VueRouter)

const routes = [
  { path: '/', redirect: '/login' },
  { path: '/login', component: Login },
  {
    path: '/home',
    component: Home,
    redirect: '/welcome',
    children: [
      { path: '/welcome', component: Welcome },
      { path: '/users', component: Users },
      { path: '/rights', component: Rights },
      { path: '/roles', component: Roles },
      { path: '/goods', component: goodList },
      { path: '/params', component: Sort },
      { path: '/categories', component: goodSort },
      { path: '/goods/add', component: Addgoods }
    ]
  }

]

const router = new VueRouter({
  routes
})

export default router
